<?php
$post = $this->getPostById($postId);
//print_r($post);exit();
?>
<body class="double-diagonal blog-page blog-post">
<!-- Preloader Starts -->
<div class="preloader" id="preloader">
    <div class="logopreloader">
        <img src="<?php echo Yii::app()->theme->baseUrl; ?>/style/img/logo-black.png" alt="logo-black">
    </div>
    <div class="loader" id="loader"></div>
</div>
<!-- Preloader Ends -->
<!-- Page Wrapper Starts -->
<div class="wrapper">
    <!-- Header Starts -->
    <header id="header" class="header">
        <div class="header-inner">
            <!-- Navbar Starts -->
            <nav class="navbar navbar-expand-lg p-0" id="singlepage-nav">
                <!-- Logo Starts -->
                <div class="logo">
                    <a class="navbar-brand link-menu nav-external" href="index.php">
                        <!-- Logo White Starts -->
                        <img id="logo-light" class="logo-light" src="<?php echo Yii::app()->theme->baseUrl; ?>/style/img/logo-white.png" alt="logo-light" />
                        <!-- Logo White Ends -->
                        <!-- Logo Black Ends -->
                        <img id="logo-dark" class="logo-dark" src="<?php echo Yii::app()->theme->baseUrl; ?>/style/img/logo-black.png" alt="logo-dark" />
                        <!-- Logo Black Ends -->
                    </a>
                </div>
                <!-- Logo Ends -->
                <!-- Hamburger Icon Starts -->
                <button class="navbar-toggler p-0" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
						<span id="icon-toggler">
						  <span></span>
						  <span></span>
						  <span></span>
						  <span></span>
						</span>
                </button>
                <!-- Hamburger Icon Ends -->
                <!-- Navigation Menu Starts -->
                <div class="collapse navbar-collapse nav-menu" id="navbarSupportedContent">
                    <ul class="nav-menu-inner ml-auto">
                        <li><a class="link-menu nav-external" href="index.php?r=post/list&categoryid=<?php echo $post['post']['category_id']; ?>"><i class="fa fa-arrow-left"></i> 返回分类页</a></li>
                        <li><a class="link-menu nav-external" href="index.php"><i class="fa fa-home"></i> 返回首页</a></li>
                    </ul>
                </div>
                <!-- Navigation Menu Ends -->
            </nav>
            <!-- Navbar Ends -->
        </div>
    </header>
    <!-- Banner Starts -->
    <section class="banner">
        <div class="content text-center">
            <div class="text-center top-text">
                <h1><?php echo $post['post']['title']; ?></h1>
                <hr>
                <h4>
                    <span class="date"><i class="fa fa-calendar"></i>&nbsp;&nbsp;<?php echo $post['post']['createtime']; ?></span>
                </h4>
            </div>
        </div>
    </section>
    <!-- Banner Ends -->
    <!-- Blog Section Starts -->
    <section id="blog" class="blog">
        <!-- Container Starts -->
        <div class="container">
            <div class="row">
                <div class="col-sm-12 col-md-12 col-lg-8">
                    <!-- Blog Posts Starts -->
                    <div class="blog-content">
                        <!-- Article Starts -->
                        <article>
                            <a href="index.php?r=post/view&post_id=<?php echo $post['post']['post_id']; ?>"><h3><?php echo $post['post']['title']; ?></h3></a>
                            <!-- Figure Starts -->
                            <?php
                            if(isset($post['meta']['imagePath'])){
                                ?>
                                <!-- Figure Starts -->
                                <figure class="blog-figure">
                                    <a href="index.php?r=post/view&post_id=<?php echo $post['post']['post_id']; ?>">
                                        <img class="img-fluid" width="748px" src="<?php echo $post['meta']['imagePath']; ?>" alt="<?php echo $post['post']['title']; ?>">
                                    </a>
                                </figure>
                                <!-- Figure Ends -->
                                <?php
                            }
                            ?>
                            <!-- Figure Ends -->
                            <!-- Excerpt Starts -->
                            <div class="blog-excerpt">
                                <?php echo $post['post']['content']; ?>
                            </div>
                            <!-- Excerpt Ends -->
                            <!-- Meta Starts -->
                            <div class="meta">
                                <span class="date"><i class="fa fa-calendar"></i><?php echo $post['post']['createtime']; ?></span>
                            </div>
                            <!-- Meta Ends -->
                        </article>
                        <!-- Article Ends -->
                    </div>
                    <!-- Latest Blog Posts Ends -->
                </div>
                <!-- Sidebar Starts -->
                <div class="col-sm-12 col-md-12 col-lg-4 sidebar">
                    <!-- Widget Recent Posts Starts -->
                    <div class="widget recent-posts col-sm-12">
                        <h3>最新新闻</h3>
                        <ul>
                            <?php
                            $recentPosts = $this->getRecentPost($post['post']['category_id']);
                            foreach ($recentPosts as $post){
                                ?>
                                <li>
                                    <figure class="featured-thumbnail thumbnail">
                                        <a href="index.php?r=post/view&post_id=<?php echo $post['post']['post_id']; ?>"><img  style="width: 120px;height: 120px;" src="<?php echo $post['meta']['imagePath']; ?>" alt=""></a>
                                    </figure>
                                    <span><i class="fa fa-calendar"></i><?php echo $post['post']['createtime']; ?></span>
                                    <h4><a href="index.php?r=post/view&post_id=<?php echo $post['post']['post_id']; ?>"><?php echo $post['post']['title']; ?></a></h4>
                                </li>
                                <?php
                            }
                            ?>
                        </ul>
                    </div>
                    <!-- Widget Recent Posts Ends -->
                </div>
                <!-- Sidebar Ends -->
            </div>
        </div>
    </section>
    <!-- Blog Section Ends -->
    <?php
    $this->renderFile(Yii::app()->theme->viewPath . '/include/footer.php');
    ?>
    <!-- Back To Top Starts -->
    <div id="back-top-wrapper" class="hidden-xs">
        <p id="back-top">
            <a href="#top"><span></span></a>
        </p>
    </div>
    <!-- Back To Top Ends -->
</div>
<!-- Wrapper Ends -->

<!-- Template JS Files -->
<script type="text/javascript" src="<?php echo Yii::app()->theme->baseUrl; ?>/style/js/jquery-2.2.4.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->theme->baseUrl; ?>/style/js/plugins/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->theme->baseUrl; ?>/style/js/plugins/bootstrap.bundle.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->theme->baseUrl; ?>/style/js/plugins/jquery.bxslider.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->theme->baseUrl; ?>/style/js/plugins/jquery.filterizr.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->theme->baseUrl; ?>/style/js/plugins/jquery.magnific-popup.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->theme->baseUrl; ?>/style/js/plugins/jquery.singlePageNav.min.js"></script>

<!-- Main JS Initialization File -->
<script type="text/javascript" src="<?php echo Yii::app()->theme->baseUrl; ?>/style/js/custom.js"></script>

<!-- Revolution Slider Initialization Ends -->
</body>